<html>

<head>
    <script>
        var openFile = function(event) {
            var input = event.target;

            var reader = new FileReader();
            reader.onload = function() {
                var text = reader.result;
                var node = document.getElementById('output');
                node.innerText = text;
                console.log(reader.result.substring(0, 10));
            };
            reader.readAsText(input.files[0]);
        };
    </script>
</head>

<body>
    <input type='file' accept='text/plain' onchange='openFile(event)'><br>
    <div id='output'>
        ...
    </div>
</body>

</html>